package kr.hyunist.androidcomplete01saeildamil.ch19;

import kr.hyunist.androidcomplete01saeildamil.R;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

public class ThreadHandlerTest extends Activity {
	blackWindz bwz;
	blackHeaven bh;
	whiteHell wh;
	deathCrown dc;
	bloodWind bw;
	TextView mBlackWindz;
	TextView mBlackHeaven;
	TextView mWhiteHell;
	TextView mDeathCrown;
	TextView mBloodWind;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.threadhandlertest);

		mBlackWindz = (TextView) findViewById(R.id.threadhandler1);
		mBlackHeaven = (TextView) findViewById(R.id.threadhandler2);
		mWhiteHell = (TextView) findViewById(R.id.threadhandler3);
		mDeathCrown = (TextView) findViewById(R.id.threadhandler4);
		mBloodWind = (TextView) findViewById(R.id.threadhandler5);

		bwz = new blackWindz(blackWindzHandler);
		bwz.setDaemon(true);
		bwz.start();

		bh = new blackHeaven(blackHeavenHandler);
		bh.setDaemon(true);
		bh.start();

		wh = new whiteHell(whiteHellHandler);
		wh.setDaemon(true);
		wh.start();

		dc = new deathCrown(deathCrownHandler);
		dc.setDaemon(true);
		dc.start();

		bw = new bloodWind(bloodWindHandler);
		bw.setDaemon(true);
		bw.start();
	}

	Handler blackWindzHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			if (msg.what == 0) {

			}
		}

	};

	Handler blackHeavenHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {

		}

	};

	Handler whiteHellHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {

		}

	};

	Handler deathCrownHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {

		}

	};

	Handler bloodWindHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {

		}

	};
}

class blackWindz extends Thread {
	Handler blackWindzHandler;
	String[] skill = { "숨겨진칼날", "숨기", "죽음의 댄스" };

	public blackWindz(Handler blackWindzHandler) {
		this.blackWindzHandler = blackWindzHandler;
	}

	@Override
	public void run() {
		while (true) {
			blackWindzHandler.sendEmptyMessage(0);
			try {
				Thread.sleep(3000);
			} catch (Exception e) {
				e.getStackTrace();
			}
		}
	}

}

class blackHeaven extends Thread {
	Handler blackHeavenHandler;

	public blackHeaven(Handler blackHeavenHandler) {
		this.blackHeavenHandler = blackHeavenHandler;
	}

	@Override
	public void run() {
		while (true) {

		}
	}

}

class whiteHell extends Thread {
	Handler whiteHellHandler;

	public whiteHell(Handler whiteHellHandler) {
		this.whiteHellHandler = whiteHellHandler;
	}

	@Override
	public void run() {
		while (true) {

		}
	}

}

class deathCrown extends Thread {
	Handler deathCrownHandler;

	public deathCrown(Handler deathCrownHandler) {
		this.deathCrownHandler = deathCrownHandler;
	}

	@Override
	public void run() {
		while (true) {

		}
	}

}

class bloodWind extends Thread {
	Handler bloodWindHandler;

	public bloodWind(Handler bloodWindHandler) {
		this.bloodWindHandler = bloodWindHandler;
	}

	@Override
	public void run() {
		while (true) {

		}
	}

}
